/*
 * @lc app=leetcode.cn id=1869 lang=javascript
 *
 * [1869] 哪种连续子字符串更长
 */

// @lc code=start
/**
 * @param {string} s
 * @return {boolean}
 */
var checkZeroOnes = function (s) {
  let max = {
    '0': 0,
    '1': 0
  };
  let cur = {
    '0': 0,
    '1': 0
  };
  let c;
  s.split('').forEach(ch => {
    if (c !== ch) {
      cur[ch] = 1;
    } else {
      cur[ch]++;
    }
    c = ch;
    max[ch] = Math.max(max[ch], cur[ch]);
  })
  console.log(cur, max);
  return max[1] > max[0];
};
// @lc code=end

checkZeroOnes("1101");
